package com.jubao.ejb.business;

import java.util.List;

import com.jubao.ejb.entity.Coupon;
import com.jubao.ejb.entity.CouponItem;
import com.jubao.ejb.entity.GeneRelation;
import com.jubao.ejb.entity.Store;
import com.jubao.ejb.entity.StoreTransaction;
import com.jubao.ejb.entity.User;

public interface StoreBusiness {

	/**
	 * get stores who are member of areaCategory and businessCategory
	 * 
	 * @param areaCategorySysId
	 * @param businessCategorySysId
	 * @param pgno
	 * @param pgsize
	 * @return
	 */
	public List<Store> getStoreList(long areaCategorySysId, long businessCategorySysId, int pgno, int pgsize);

	/**
	 * get count of stores who are member of areaCategory and businessCategory
	 * 
	 * @param areaCategorySysId
	 * @param businessCategorySysId
	 * @return
	 */
	public long getStoreCount(long areaCategorySysId, long businessCategorySysId);

	/**
	 * set store servant 
	 * 
	 * @param storeSysId
	 * @param userSysId
	 * @return
	 */
	public GeneRelation setServant(long storeSysId, long userSysId);

	/**
	 * Find store servant 
	 * 
	 * @param storeSysId
	 * @return
	 */
	public User findServant(long storeSysId);

	/**
	 * add store as member of the primary category trail
	 * 
	 * @param storeSysId
	 * @param categorySysId
	 */
	public void add2CateogryTrail(long storeSysId, long categorySysId);

	/**
	 * remove store from member of the primary category trail of categorySysId
	 * 
	 * @param storeSysId
	 * @param categorySysId
	 */
	public void removeFromCategoryTrail(long storeSysId, long categorySysId);

	/**
	 * Get store coupon list 
	 * 
	 * @param storeSysId
	 * @param pgno
	 * @param pgsize
	 * @return
	 */
	public List<Coupon> getCouponList(long storeSysId, int pgno, int pgsize);

	/**
	 * Get count of store coupons
	 * @param storeSysId
	 * @return
	 */
	public long getCouponCount(long storeSysId);

	/**
	 * get coupon item list 
	 * 
	 * @param storeSysId
	 * @param couponSysId
	 * @param userSysId
	 * @param pgno
	 * @param pgsize
	 * @return
	 */
	public List<CouponItem> getCouponItemList(long storeSysId, long couponSysId, long userSysId, int pgno, int pgsize);

	/**
	 * get count of coupon item
	 * @param storeSysId
	 * @param couponSysId
	 * @param userSysId
	 * @return
	 */
	public long getCouponItemCount(long storeSysId, long couponSysId, long userSysId);

	/**
	 * get store StoreTransaction list 
	 * 
	 * @param storeSysId
	 * @param pgno
	 * @param pgsize
	 * @return
	 */
	public List<StoreTransaction> getStoreTransactionList(long storeSysId, int pgno, int pgsize);

	/**
	 * get count of store StoreTransaction
	 * 
	 * @param storeSysId
	 * @return
	 */
	public long getStoreTransactionCount(long storeSysId);

	/**
	 * 
	 * new a store transaction and compute the balance , will be called by {@link #newCouponItem(long, long, long, CouponItem, long)}
	 * 
	 * @param storeSysId
	 * @param value
	 * @param shortDesc
	 * @param couponItemSysId
	 * @param operatorUserSysId
	 * @return
	 */
	public StoreTransaction newStoreTransaction(long storeSysId, int value, String shortDesc, long couponItemSysId,
			long operatorUserSysId);

	/**
	 * Create a coupon item for user, typically used by store to present a coupon item to customer
	 * 
	 * @see #confirmCouponItem(long, CouponItem)
	 * 
	 * @param storeSysId
	 * @param couponSysId
	 * @param customerUserSysId
	 * @param couponItem
	 * @return
	 */
	public CouponItem newCouponItem(long storeSysId, long couponSysId, long customerUserSysId, CouponItem couponItem,
			long operatorUserSysId);

	/**
	 * Confirm coupon item presented by store,  
	 * 
	 * @see #newCouponItem(long, long, long, CouponItem)
	 * 
	 * @param userSysId
	 * @param couponItem holding coupon item information
	 * @return
	 */
	public CouponItem confirmCouponItem(long userSysId, CouponItem couponItem);

}
